import service from '/@/utils/request';

export const useLadderDeviceQueryApi = (code: string,) => {
    return service({
        url: `v0/ladder/device/query`,
        method: 'GET',
        params: { code: code },
    });
}
export const useLadderDevicePageApi = (formData?: object) => {
    return service({
        url: `v0/ladder/device/page`,
        method: 'POST',
        data: formData
    });
}

export const useLadderDeviceCreateApi = (formData: object) => {
    return service({
        url: `v0/ladder/device/create`,
        method: 'POST',
        data: formData
    });
}
export const useLadderDeviceUpdateApi = (formData: object) => {
    return service({
        url: `v0/ladder/device/update`,
        method: 'PUT',
        data: formData
    });
}

export const useLadderDeviceDeleteApi = (param: string | string[]) => {
    let arrList: string[] = []

    if (param instanceof Array) {
        arrList = param
    } else {
        arrList.push(param)
    }

    return service({
        url: `v0/ladder/device/delete`,
        method: 'DELETE',
        data: { codeList: arrList }
    });
}

export const useLadderDeviceListApi = () => {
    return service({
        url: `v0/ladder/device/list`,
        method: 'GET'
    });
}

